//
//  SISSHousesBasicInfoView.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/9/11.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSHousesBasicInfoView.h"
#import "SISSTitleView.h"

@interface SISSHousesBasicInfoView ()

@property (weak, nonatomic) SISSTitleView *titleView;
@property (weak, nonatomic) UILabel *panelnameTitleLabel;
@property (weak, nonatomic) UILabel *panelnameLabel;
@property (weak, nonatomic) UILabel *propertyTypeTitleLabel;
@property (weak, nonatomic) UILabel *propertyTypeLabel;
@property (weak, nonatomic) UILabel *buildingTypesTitleLabel;
@property (weak, nonatomic) UILabel *buildingTypesLabel;
@property (weak, nonatomic) UILabel *coverAreaTitleLabel;
@property (weak, nonatomic) UILabel *coverAreaLabel;
@property (weak, nonatomic) UILabel *plotRatioTitleLabel;
@property (weak, nonatomic) UILabel *plotRatioLabel;
@property (weak, nonatomic) UILabel *floorAreaTitleLabel;
@property (weak, nonatomic) UILabel *floorAreaLabel;
@property (weak, nonatomic) UILabel *greenRateTitleLabel;
@property (weak, nonatomic) UILabel *greenRateLabel;
@property (weak, nonatomic) UILabel *propertyManagementFeeTitleLabel;
@property (weak, nonatomic) UILabel *propertyManagementFeeLabel;
@property (weak, nonatomic) UILabel *projectAddressTitleLabel;
@property (weak, nonatomic) UILabel *projectAddressLabel;
@property (weak, nonatomic) UILabel *propertyManagementCompanyTitleLabel;
@property (weak, nonatomic) UILabel *propertyManagementCompanyLabel;

@end
@implementation SISSHousesBasicInfoView

- (void)setmodel {
    self.panelnameLabel.text = @"";
}

- (void)setBuildInfo:(SISSBuildInfoModel *)buildInfo {
    _buildInfo = buildInfo;
    
    self.panelnameLabel.text = buildInfo.townAndBlock;
    self.propertyTypeLabel.text = buildInfo.htype;
    self.buildingTypesLabel.text = buildInfo.btype;
    self.coverAreaLabel.text = buildInfo.landSqar;
    self.plotRatioLabel.text = buildInfo.far;
    self.floorAreaLabel.text = buildInfo.buildSqar;
    self.greenRateLabel.text = buildInfo.greenRate;
    self.propertyManagementFeeLabel.text = buildInfo.propertyExpense;
    self.projectAddressLabel.text = buildInfo.buildingAddress;
    self.propertyManagementCompanyLabel.text = buildInfo.brokCom;
}

- (void)initUI {
    [super initUI];
    
    SISSTitleView *titleView = [[SISSTitleView alloc] init];
    titleView.titleStr = @"楼盘基本信息";
    titleView.titleColor = MAIN_TEXT_COLOR;
    [self addSubview:titleView];
    self.titleView = titleView;
    
    UILabel *panelnameTitleLabel = [UILabel yyr_labelWithText:@"所属板块：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:panelnameTitleLabel];
    self.panelnameTitleLabel = panelnameTitleLabel;
    
    UILabel *panelnameLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:panelnameLabel];
    self.panelnameLabel = panelnameLabel;
    
    
    UILabel *propertyTypeTitleLabel = [UILabel yyr_labelWithText:@"物业类型：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:propertyTypeTitleLabel];
    self.propertyTypeTitleLabel = propertyTypeTitleLabel;
    
    UILabel *propertyTypeLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR ];
    [self addSubview:propertyTypeLabel];
    self.propertyTypeLabel = propertyTypeLabel;
    
    UILabel *buildingTypesTitleLabel = [UILabel yyr_labelWithText:@"建筑形式：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:buildingTypesTitleLabel];
    self.buildingTypesTitleLabel = buildingTypesTitleLabel;
    
    UILabel *buildingTypesLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:buildingTypesLabel];
    self.buildingTypesLabel = buildingTypesLabel;
    
    UILabel *coverAreaTitleLabel = [UILabel yyr_labelWithText:@"占地面积：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:coverAreaTitleLabel];
    self.coverAreaTitleLabel = coverAreaTitleLabel;
    
    UILabel *coverAreaLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:coverAreaLabel];
    self.coverAreaLabel = coverAreaLabel;
    
    UILabel *plotRatioTitleLabel = [UILabel yyr_labelWithText:@"容积率：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:plotRatioTitleLabel];
    self.plotRatioTitleLabel = plotRatioTitleLabel;
    
    UILabel *plotRatioLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:plotRatioLabel];
    self.plotRatioLabel = plotRatioLabel;
    
    UILabel *floorAreaTitleLabel = [UILabel yyr_labelWithText:@"建筑面积：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:floorAreaTitleLabel];
    self.floorAreaTitleLabel = floorAreaTitleLabel;
    
    UILabel *floorAreaLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:floorAreaLabel];
    self.floorAreaLabel = floorAreaLabel;
    
    UILabel *greenRateTitleLabel = [UILabel yyr_labelWithText:@"绿化率：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:greenRateTitleLabel];
    self.greenRateTitleLabel = greenRateTitleLabel;
    
    UILabel *greenRateLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:greenRateLabel];
    self.greenRateLabel = greenRateLabel;
    
    UILabel *propertyManagementFeeTitleLabel = [UILabel yyr_labelWithText:@"物业费：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:propertyManagementFeeTitleLabel];
    self.propertyManagementFeeTitleLabel = propertyManagementFeeTitleLabel;
    
    UILabel *propertyManagementFeeLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:propertyManagementFeeLabel];
    self.propertyManagementFeeLabel = propertyManagementFeeLabel;
    
    UILabel *projectAddressTitleLabel = [UILabel yyr_labelWithText:@"项目地址：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:projectAddressTitleLabel];
    self.projectAddressTitleLabel = projectAddressTitleLabel;
    
    UILabel *projectAddressLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:projectAddressLabel];
    self.projectAddressLabel = projectAddressLabel;
    
    UILabel *propertyManagementCompanyTitleLabel = [UILabel yyr_labelWithText:@"物业：" fontSize:15 textColor:SECONDARY_TEXT_COLOR];
    [self addSubview:propertyManagementCompanyTitleLabel];
    self.propertyManagementCompanyTitleLabel = propertyManagementCompanyTitleLabel;
    
    UILabel *propertyManagementCompanyLabel = [UILabel yyr_labelWithText:@"" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self addSubview:propertyManagementCompanyLabel];
    self.propertyManagementCompanyLabel = propertyManagementCompanyLabel;

}

- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGFloat margin = 8.0;
    [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(weakSelf);
        make.height.mas_equalTo(5.5 * margin);
    }];
    
    [self.panelnameTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.titleView.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf).offset(2 * margin);
    }];
    
    [self.panelnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.panelnameTitleLabel);
        make.left.equalTo(weakSelf.panelnameTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.propertyTypeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.panelnameTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.panelnameTitleLabel);
    }];
    
    [self.propertyTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.propertyTypeTitleLabel);
        make.left.equalTo(weakSelf.propertyTypeTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.buildingTypesTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.propertyTypeTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.propertyTypeTitleLabel);
    }];
    
    [self.buildingTypesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.buildingTypesTitleLabel);
        make.left.equalTo(weakSelf.buildingTypesTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.coverAreaTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.buildingTypesTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.buildingTypesTitleLabel);
    }];
    
    [self.coverAreaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.coverAreaTitleLabel);
        make.left.equalTo(weakSelf.coverAreaTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.plotRatioTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.coverAreaTitleLabel);
        make.left.equalTo(weakSelf.mas_centerX);
    }];
    
    [self.plotRatioLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.plotRatioTitleLabel);
        make.left.equalTo(weakSelf.plotRatioTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.floorAreaTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.coverAreaTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.coverAreaTitleLabel);
    }];
    
    [self.floorAreaLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.floorAreaTitleLabel);
        make.left.equalTo(weakSelf.floorAreaTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.greenRateTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.floorAreaTitleLabel);
        make.left.equalTo(weakSelf.mas_centerX);
    }];
    
    [self.greenRateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.greenRateTitleLabel);
        make.left.equalTo(weakSelf.greenRateTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.propertyManagementFeeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.floorAreaTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.floorAreaTitleLabel);
    }];
    
    [self.propertyManagementFeeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.propertyManagementFeeTitleLabel);
        make.left.equalTo(weakSelf.propertyManagementFeeTitleLabel.mas_right).offset(0.5 * margin);
    }];
   
    [self.projectAddressTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.propertyManagementFeeTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.propertyManagementFeeTitleLabel);
    }];
    
    [self.projectAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.projectAddressTitleLabel);
        make.left.equalTo(weakSelf.projectAddressTitleLabel.mas_right).offset(0.5 * margin);
    }];
    
    [self.propertyManagementCompanyTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.projectAddressTitleLabel.mas_bottom).offset(2 * margin);
        make.left.equalTo(weakSelf.projectAddressTitleLabel);
        make.bottom.equalTo(weakSelf).offset(-margin);
    }];
    
    [self.propertyManagementCompanyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.propertyManagementCompanyTitleLabel);
        make.left.equalTo(weakSelf.propertyManagementCompanyTitleLabel.mas_right).offset(0.5 * margin);
    }];
}

@end
